#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int a[105][105];
int main()
{
	// 请在此输入您的代码
	int n ;
	cin >>n;
	memset(a,-1,sizeof(a));
	for(int i = 1; i <= n;i ++){
		for(int  j = 1; j <= i;j ++)
			cin >> a[i][j];
	}
	
	for(int i =2 ; i <= n ; i++){
		for(int j = 1; j <=i ; j ++){
			a[i][j] += max(a[i-1][j],a[i-1][j-1]);
		}
	}

	if(n % 2 == 0		) 
		cout << max(a[n][n/2],a[n][n/2+1]) <<endl;
	else 
		cout << a[n][(int) n/2 +1]<<endl;
//	cout << max <<endl;  
	return 0;
}
